﻿using Microsoft.EntityFrameworkCore;
using MyModule.Breeding;
using MyModule.ManageSheep;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.EntityFrameworkCore;

namespace FinalItem.MyModule
{
    public class MyModuleMigrationsDbContext :AbpDbContext<MyModuleMigrationsDbContext>
    {
        public MyModuleMigrationsDbContext(DbContextOptions<MyModuleMigrationsDbContext> options)
            : base(options) 
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //modelBuilder.ConfigureMyModule();
            modelBuilder.Entity<WeighInfo>(b =>
            {
                b.ToTable("WeighInfo");
                //b.ConfigureByConvention();
                b.Property(x => x.Earbugles).IsRequired().HasMaxLength(50);

            });
            //称重类型表
            modelBuilder.Entity<WeighType>(b =>
            {
                b.ToTable("WeighType");
                //b.ConfigureByConvention();
                b.Property(x => x.WTname).IsRequired().HasMaxLength(50);

            });
            //体尺测定表
            modelBuilder.Entity<BodySize>(b =>
            {
                b.ToTable("BodySize");
                //b.ConfigureByConvention(); 
                b.Property(x => x.Earbugles).IsRequired().HasMaxLength(50);

            });
            // 品相
            modelBuilder.Entity<Appearance>(b =>
            {
                b.ToTable("Appearance");
                //b.ConfigureByConvention();
                b.Property(x => x.Earbugles).IsRequired().HasMaxLength(50);

            });
            //品种
            modelBuilder.Entity<VarietyInfo>(b =>
            {
                b.ToTable("VarietyInfo");
                //b.ConfigureByConvention();
                b.Property(x => x.Vname).IsRequired().HasMaxLength(50);

            });
            //淘汰原因
            modelBuilder.Entity<EliminateCause>(b =>
            {
                b.ToTable("EliminateCause");
                //b.ConfigureByConvention();
                b.Property(x => x.ECname).IsRequired().HasMaxLength(50);

            });
            //羊只淘汰表
            modelBuilder.Entity<Eliminate>(b =>
            {
                b.ToTable("Eliminate");
                //b.ConfigureByConvention();
                b.Property(x => x.Earbugles).IsRequired().HasMaxLength(50);
                b.Property(x => x.Emeasures).IsRequired().HasMaxLength(50);
                b.Property(x => x.Ebuildings).IsRequired().HasMaxLength(50);
                b.Property(x => x.Ecolumns).IsRequired().HasMaxLength(50);

            });
            // 繁殖状态
            modelBuilder.Entity<Dreproduction>(b =>
            {
                b.ToTable("Dreproduction");
                //b.ConfigureByConvention();
                b.Property(x => x.Rname).IsRequired().HasMaxLength(50);

            });
            //养只死亡表
            modelBuilder.Entity<DeathInfo>(b =>
            {
                b.ToTable("DeathInfo");
                //b.ConfigureByConvention();
                b.Property(x => x.Earbugles).IsRequired().HasMaxLength(50);
                b.Property(x => x.Dbuildings).IsRequired().HasMaxLength(50);
                b.Property(x => x.Columns).IsRequired().HasMaxLength(50);
            });
            //死亡原因
            modelBuilder.Entity<CauseInfo>(b =>
            {
                b.ToTable("CauseInfo");
                //b.ConfigureByConvention();
                b.Property(x => x.Cname).IsRequired().HasMaxLength(50);
            });
        }
    }
}
